package cn.wolfcode.trip.app.controller;

import cn.wolfcode.trip.base.domain.Hotel;
import cn.wolfcode.trip.base.query.HotelQueryObjext;
import cn.wolfcode.trip.base.service.IHotelService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hotel")
public class Hotelcontroller {
    @Autowired
    private IHotelService hotelService;

    //查询所有的酒店
    @GetMapping
    public PageInfo list(HotelQueryObjext qo){
        PageInfo hotel = hotelService.hotel(qo);
        return hotel;
    }

    //查询单个酒店
    @GetMapping("/{id}")
    public Hotel get(@PathVariable Long id){
        return hotelService.get(id);
    }
}
